{% extends "base.html" %}
{% load i18n %}

{% block title %}{% trans "Messages" %}{% endblock %}

{% block page-title %}{% trans "Messages" %}{% endblock %}

{% block navigation %}
  {% activetab "main" "dashboard" %}
  {{ block.super }}
{% endblock %}

{% block sub-navigation %}
  <form method='post' action="">
  {% csrf_token %}
  <ul>
    <li><a href="{% url inhouse.views.starred_bookings %}">{% trans "Starred bookings" %}</a></li>
    <li><a href="{% url inhouse.views.show_messages %}" style="font-weight: bold;">{% trans "Messages" %}</a></li>
    <li><a href="/dashboard/news">{% trans "News" %}</a></li>
      <select name="filter_selection" id="id_filter_selection">
        <option value="1" {% ifequal filter 1 %}selected="selected"{% endifequal %}>{% trans "Inbox" %}</option>
        <option value="2" {% ifequal filter 2 %}selected="selected"{% endifequal %}>{% trans "Sent Messages" %}</option>
        <option value="3" {% ifequal filter 3 %}selected="selected"{% endifequal %}>{% trans "All Messages" %}</option>
        <input type="submit" value="{% trans "Show" %}" name="filter">
      </select>
  </ul>
  </form>
{% endblock %}

{% block content %}
  <form method="post">
  {% csrf_token %}
  <h3>
    <a id="messages-pointer" href="javascript:inhouse.toggle_section('messages');" class="toggled-section">
    {% ifequal filter 0 %}{% trans "Inbox" %}{% endifequal %}
    {% ifequal filter 1 %}{% trans "Inbox" %}{% endifequal %}
    {% ifequal filter 2 %}{% trans "Sent Messages" %}{% endifequal %}
    {% ifequal filter 3 %}{% trans "All Messages" %}{% endifequal %}
    </a>
  </h3>
  <div id="messages" class="default-list">
    <div class="pagination">
      <div style="float:left;">
        <a href="javascript:inhouse.toggle_checkboxes('message-list', true);">{% trans "Select all" %}</a>
        |
        <a href="javascript:inhouse.toggle_checkboxes('message-list', false);">{% trans "Deselect all" %}</a>
      </div>
      <div style="float: right;">
          <input type="submit" value="{% trans "Archive" %}" name="archive">
          <input type="submit" value="{% trans "Mard as read" %}" name="read">
      </div>
    </div>
    <table id="message-list" class="default-table">
      <thead>
        {% include "message_heading.html" %}
      </thead>
      <tbody>
        {% for message in msgs.object_list %}
          {% include "message_row.html" %}
        {% empty %}
          <tr><td class="first last" colspan="11">{% trans "No entries found" %}</td></tr>
        {% endfor %}
      </tbody>
    </table>
    <div class="pagination">
      {% include "pagination.html" with objects=msgs %}
    </div>
  </div>
  </form>
{% endblock %}
